package com.song.pj.module.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 业务场景？
 * 客户端向服务器端发起一个请求，服务端处理完请求以后，直接将响应数据封装到model中，然后和
 */
@Controller
public class ModelViewController {
    @RequestMapping("doModelAndView")
    public String doModelAndView(Model model){

        model.addAttribute("username", "xuegang");
        model.addAttribute("state", "zishenSB250");

        return "view";
    }
    @RequestMapping("doModelAndView2")
    public ModelAndView doModelAndView(ModelAndView mv){

        mv.addObject("username", "xuegang");
        mv.addObject("state", "zishenSB250");
        mv.setViewName("view");
        return mv;
    }
}
